<%@page import="javax.swing.text.Document"%>
<%@page import="java.sql.*"%>
<%@page import="com.mysql.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Rentflix Movie Queue</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
	<%
    try{
//Class.forName("com.mysql.jdbc.Driver");
Connection connection = 
         DriverManager.getConnection
            ("jdbc:mysql://localhost:3306/moviedatabase","kyle","hightower");

       Statement statement = connection.createStatement() ;

       ResultSet rs = statement.executeQuery("select distinct Genre from Movies");
%>

    <h1> Queues in database</h1>
    <br />
		<input type="text" id="idGenre" name="txtGenre" value="Love" >
        <select name="genrePick">
        <%  while(rs.next()){ %>
            <option><%= rs.getString(1)%></option>
        <% } %>
        </select>
        

<%
        }
        catch(Exception e)
        {
             out.println("wrong entry"+e);
        }
%>

<%
    try{
//Class.forName("com.mysql.jdbc.Driver");
Connection connection = 
         DriverManager.getConnection
            ("jdbc:mysql://localhost:3306/moviedatabase","kyle","hightower");

       Statement statement = connection.createStatement() ;

       ResultSet rs = statement.executeQuery("select q.QueueID, m.Title, u.UserName from queue q LEFT OUTER JOIN "
    		   + "movies m ON q.MovieID = m.MovieID LEFT OUTER JOIN users u ON q.UserID = u.UserID");
%>

    <br />

        <table style="width:300px">
        <%  while(rs.next()){ %>
		<tr>
		  <td><%= rs.getString(1)%></td>
		  <td><%= rs.getString(2)%></td> 
		  <td><%= rs.getString(3)%></td>
		</tr>
        <% } %>
		</table>

<%
        }
        catch(Exception e)
        {
             out.println("wrong entry"+e);
        }
%>
</body>
</html>